from Utilities.AutoGetOperator.selectPackage import get_func
Operator=get_func(r'Operators/OWAOperator/Operator.py','Operator')

class IHOWA(Operator):
    def getResult(self):
        # 对数据进行简化
        data = self.data_list
        weight = self.heavy_weight_list
        U = self.U_list
        # 对U进行升序排列，并获得其对应索引位置
        U = self.U_asc(U)
        # 获取初始值,根据索引位置进行data的排列
        res = data[U[0]] * weight[0]
        for i in range(1,len(data)):
            res += data[U[i]] * weight[i]

        return res

if __name__ == '__main__':
    data_list = [343.30,412.71,389.42,372.68,363.49,363.28]
    heavy_weight_list = [0.10,0.10,0.20,0.20,0.20,0.30]
    U_list = [5, 15, 10, 20, 30, 25]
    pa = IHOWA(data_list)
    print(pa.getResult())